﻿<!DOCTYPE html>

<!--培训计划管理-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <style>
        .el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }
    </style>
</head>



<body>
    
<div id="app" v-cloak>   
        <!-- <el-container style="height:100%">
            <el-header style="height:auto"> -->
        <el-form label-position=" right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool popupW100">
                    
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />培训计划管理列表</strong></div>
<span>
    <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
    </btn>
    <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn>
    <btn :text="col.btnTrainingPlanGeneration" imgsrc="/static/images/general.png" linetype="3"
         @click="trainingPlanGeneration"></btn>
    <btn-export-list url="/api/PX_Plan/Export" :forminline="this.formInline" linetype="3"></btn-export-list>
    <btn :text="col.btnSendnotifications" imgsrc="/static/images/general.png" linetype="3"
         @click="btnSendnotifications"></btn>
    <btn :text="col.btnInputsummaryreport" imgsrc="/static/images/general.png" linetype="3"
         @click="UserInputStatistics"></btn>
    <btn :text="'完成培训'" imgsrc="/static/images/general.png" linetype="3"
         @click="WCPX"></btn>
    <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
</span>
                </el-col>
            </el-row>
            <el-row>
                <list-factorys v-model="formInline.model.createFactory" @change="factoryChange"></list-factorys>
                <!--<el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
        <div class="elst-select-mini">
            <el-form-item>
                <el-input v-model="formInline.model.Nameoftrainingplan"
                          :placeholder="TrainingPlanManagement.Nameoftrainingplan" size="mini">
                    <template slot="prepend">
                        {{TrainingPlanManagement.Nameoftrainingplan+mark.m}}
                    </template>
                </el-input>
            </el-form-item>
        </div>
    </el-col>-->
                <!--<el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
        <div class="elst-select-mini">
            <el-form-item size="mini">
                <el-input>
                    <template slot="prepend">
                        {{TrainingPlanManagement.TrainingMatrix+mark.m}}
                    </template>
                    <el-select @visible-change="visibleChange" v-model="formInline.model.TrainingMatrix" slot="suffix"
                               :placeholder="TrainingPlanManagement.TrainingMatrix">
                        <el-option label="请选择" value=""></el-option>
                        <el-option v-for="item in TrainingMatrix" :label="item.value" :value="item.value">
                        </el-option>
                    </el-select>
                </el-input>

            </el-form-item>
        </div>
    </el-col>-->
                <!--<el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
        <div class="elst-select-mini">
            <el-form-item size="mini">
                <el-input>
                    <template slot="prepend">
                        {{TrainingDemandMatrixManagement.post+mark.m}}
                    </template>
                    <el-select @visible-change="visibleChange" v-model="formInline.model.post" slot="suffix"
                               :placeholder="TrainingDemandMatrixManagement.post">
                        <el-option label="请选择" value=""></el-option>
                        <el-option v-for="item in post" :label="item.name" :value="item.id">
                        </el-option>
                    </el-select>
                </el-input>
            </el-form-item>
        </div>
    </el-col>-->


                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingPlanManagement.Trainingtime+'开始'+mark.m}}
                                </template>
                                <!-- <el-date-picker v-model="formInline.model.DiscoveryTimeBegin" type="date" slot="suffix" -->
                                <el-date-picker v-model="formInline.model.trainingBeginTime" type="date" slot="suffix"
                                                size="mini" placeholder="选择日期">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingPlanManagement.Trainingtime+'结束'+mark.m}}
                                </template>
                                <!-- <el-date-picker v-model="formInline.model.DiscoveryTimeEnd" type="date" slot="suffix" -->
                                <el-date-picker v-model="formInline.model.trainingEndTime" type="date" slot="suffix"
                                                size="mini" placeholder="选择日期">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>

        </el-form>
        <el-col span="24">
            <el-table ref="table" stripe :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight"
                      border @selection-change="handleSelectionChange" row-style="height:10px"
                      highlight-current-row class="tb-edit"
                      @current-change="tableHandleCurrentChange"
                      style="width: 100%;height: 100%;">
                <el-table-column type="selection" style="
        padding-top: 0px;
        padding-bottom: 0px;
    " align="center" width="55" :reserve-selection="true">
                </el-table-column>
                <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                                 show-overflow-tooltip="true"></el-table-column>
                <!-- 除第一列以外 遍历所有字段 -->
                <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  下同-->
                <!--岗位-->
                <!--<el-table-column width="100" prop="post" :label="TrainingPlanManagement.post">
    </el-table-column>-->
                <!--培训课程-->
                <el-table-column prop="mark03" :label="TrainingPlanManagement.trainingcourse" min-width="200"
                                 show-overflow-tooltip="true">
                </el-table-column>

                <!--培训目标-->
                <el-table-column width="100" prop="target" :label="Mytraining.Trainingobjectives" show-overflow-tooltip="true">
                </el-table-column>

                <!--目标人群-->
                <el-table-column width="100" prop="mark02" :label="TrainingPlanManagement.objGroup" show-overflow-tooltip="true">
                </el-table-column>

                <!--培训时间-->
                <el-table-column width="100" prop="trainingBeginTime" :label="TrainingPlanManagement.Trainingtime" show-overflow-tooltip="true">
                </el-table-column>

                <!--参加人数-->
                <el-table-column width="100" prop="mark01" :label="TrainingPlanManagement.peopleNumber" show-overflow-tooltip="true">
                </el-table-column>
                <!--预算-->
                <el-table-column width="100" prop="trainingbudget" :label="TrainingPlanManagement.budget" show-overflow-tooltip="true">
                </el-table-column>

                <!--培训讲师-->
                <el-table-column width="100" prop="mark04" :label="TrainingPlanManagement.Trainer" show-overflow-tooltip="true">
                </el-table-column>

                <!--掌握程度-->
                <el-table-column width="100" prop="masteryLevelText" :label="TrainingPlanManagement.mastery" show-overflow-tooltip="true">
                </el-table-column>

                <!--培训方式-->
                <el-table-column width="100" prop="trainingmethodsText" :label="TrainingPlanManagement.Trainingmethods" show-overflow-tooltip="true">
                </el-table-column>

                <!--培训内容-->
                <el-table-column width="100" prop="trainingcontent" :label="TrainingPlanManagement.Trainingcontent" show-overflow-tooltip="true">
                </el-table-column>

                <!--状态-->
                <el-table-column width="100" prop="stateText" :label="TrainingPlanManagement.state">
                </el-table-column>


                <!--培训地点-->
                <!--<el-table-column prop="Trainingvenues" :label="TrainingPlanManagement.Trainingvenues">
    </el-table-column>-->
                <!--培训类型-->
                <!--<el-table-column width="100" prop="Typesoftraining" :label="TrainingPlanManagement.Typesoftraining">
    </el-table-column>-->
                <!--培训矩阵-->
                <!--<el-table-column prop="TrainingMatrix" :label="TrainingPlanManagement.TrainingMatrix" min-width="200"
                     show-overflow-tooltip="true">
    </el-table-column>-->
                <!--培训计划名称-->
                <!--<el-table-column prop="Nameoftrainingplan" :label="TrainingPlanManagement.Nameoftrainingplan"
                     min-width="200" show-overflow-tooltip="true">
    </el-table-column>-->
                <!--培训负责人-->
                <!--<el-table-column width="100" prop="HeadofTraining" :label="TrainingPlanManagement.HeadofTraining">
    </el-table-column>-->


                <el-table-column width="53" :label="col.btnUpdate" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>

                <el-table-column width="53" :label="'签到'" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=QD('qd',scope.row.id,scope.row.trainingmethods)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>
                <el-table-column width="70" :label="'成绩单'" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click=CJD('cjd',scope.row.id,scope.row.pX_Exam.examinationmethods)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>


            </el-table>
            <el-row type="flex" justify="end">

                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                               :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>
            </el-row>
            <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->

            <el-dialog title="培训计划管理" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="90%"
                       height="90%" top="10vh" fullscreen="true">
                <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
            </el-dialog>

        </el-col>

       
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                currSeelctId: "",
                currSeelctRow: {
                    
                },
                post: [],
                ListItem: ListItem,
                value1: '',
                TrainingMatrix: [],
                checked: true,
                isShow: true,
                formInline: {
                    value1: '',
                    // 遍历所有列 均为字符串即可
                    model: {
                        Name: '', Category: '', Teacher: '', LlearningTime: '', Courseware: '', IsEncrypted: '', TrainingtimeStar: '', TrainingtimeEnd: ''
                    },
                    offset: 0,
                    limit: 10
                }
            },
            mounted: function () {
                //获取下拉菜单内容
                var mythis = this;
             
               

                
               
                //列表高度自适应
                tablehigh(this);
            },
            methods: {

                factoryChange: function () {


                    //var mythis = this;
                    //myAjax("post", this, '/api/SysDuty/GetAllList', {
                    //    limit: 10,
                    //    model: { createFactory: mythis.formInline.model.createFactory }, offset: 0
                    //}, function (response) {
                    //    var ajaxModel = response.data;
                    //    mythis.post = ajaxModel;

                    //}, false);

                    this.GetPageData(1);
                },

                tableHandleCurrentChange: function (currentRow) {
                    this.currSeelctId = currentRow.id;

                    this.currSeelctCell = currentRow;

                },
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                btnSendnotifications: function () {
                    var mythis = this;
                    if (!this.currSeelctId) {
                        showMessage("请选择一条数据进行操作！", "error")
                        return;
                    }

                    if (this.currSeelctCell.state != '0') {
                        showMessage("只有暂存状态的计划可发送通知！", "error")
                        return;
                    }
                    
                    var a = new Date();
                    var b = new Date(this.currSeelctCell.trainingBeginTime);
                    b = b.setDate(b.getDate() + 1);
                    b = new Date(b);
                    
                    if (a > b) {
                        showMessage("培训开始时间已过或未设置，培训无法进行！请重新修改开始时间！", "error");
                        return;
                    }
                    
                    mythis.$confirm(' 是否确认通知?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(function () {

                        myAjax("get", mythis, '/api/PX_Plan/Notice?id=' + mythis.currSeelctCell.id, null, function (response) {

                            mythis.GetPageData(1);
                            mythis.ListItem.currentPage = 1;

                            showMessage(msg.OperatingOk, "success");
                        });
                    }).catch(function () {
                        showMessage("已取消操作!");
                    });
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                closeDialog: function () { closeDialog(this); },
                //Model 替换成 表名
                onDelete: function () { onDelete(this, '/api/PX_Plan/DeleteMuti'); },

                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Model 替换成 表名
                UserInput: function (val, id) { DialogShow(this, val, "TrainingPlanManagementInput.html", id); },
                QD: function (val, id,type) {
                    if (type == '0') {
                        showMessage("线上培训无需录入签到信息！", "error")
                        return;
                    }

                    DialogShow(this, val, "SignInManagementForm.html", id);
                },
                CJD: function (val, id,type) {
                    if (type == '0') {
                        showMessage("线上考试无需录入成绩单信息！", "error")
                        return;
                    }
                    DialogShow(this, val, "TrainingTranscriptForm.html", id);
                },
                UserInputStatistics: function (val) {
                    if (!this.currSeelctId) {
                        showMessage("请选择一条数据进行操作！", "error")
                        return;
                    }
                    if (this.currSeelctCell.state != '4') {
                        showMessage("只有已完成记录才能填写总结！", "error");
                        return;
                    }
                    DialogShow(this, val, "TrainingPlanManagementluruInput.html", this.currSeelctCell.id);
                },
                WCPX: function () {
                    if (!this.currSeelctId) {
                        showMessage("请选择一条数据进行操作！", "error")
                        return;
                    }
                    //if (this.currSeelctCell.state != '3') {
                    //    showMessage("只有已结束记录才能执行此操作！", "error");
                    //    return;
                    //}
                    DialogShow(this, '', "TrainingDemandMatrixManagementWCList.html", this.currSeelctId);
                    //var mythis = this;
                    //if (!this.currSeelctId) {
                    //    showMessage("请选择一条数据进行操作！", "error")
                    //    return;
                    //}
                    
                    //mythis.$confirm(' 是否确认完成?', '提示', {
                    //    confirmButtonText: '确定',
                    //    cancelButtonText: '取消',
                    //    type: 'warning'
                    //}).then(function () {

                    //    myAjax("get", mythis, '/api/PX_Plan/WCPX?id=' + mythis.currSeelctCell.id, null, function (response) {

                    //        mythis.GetPageData(1);
                    //        mythis.ListItem.currentPage = 1;

                    //        showMessage(msg.OperatingOk, "success");
                    //    });
                    //}).catch(function () {
                    //    showMessage("已取消操作!");
                    //});

                    
                },
                trainingPlanGeneration: function (val, id) {
                    var mythis = this;
                    mythis.$confirm('即将生成今年所在工厂的全部计划，是否确认?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(function () {
                        myAjax("get", mythis, '/api/PX_Plan/SCPXJH', null, function (response) {

                            mythis.GetPageData(1);
                            mythis.ListItem.currentPage = 1;
                            showMessage(msg.OperatingOk, "success");

                        });
                    }).catch(function () {
                        showMessage("已取消操作!");
                    });



                },
                //Model 替换成 表名
                GetPageData: function (currentIndex) {
                    //alert("yyyyyy");
                    GetPageData(this, currentIndex, '/api/PX_Plan/PCGetList')
                },

                onSubmit: function () {
                    //alert("xxxxxx");
                    onSubmit(this);
                },

                handleSizeChange: function (val) { handleSizeChange(this, val); },

                handleCurrentChange: function (val) { handleCurrentChange(this, val); },

                handleNodeClick: function (data) {
                    this.formInline.model.Category = data.id;
                    this.GetPageData(1);
                }
            }
        });
    </script>

</body>

</html>